from django.contrib import admin
from .models import TestSuite, TestCase, TestExecution

@admin.register(TestSuite)
class TestSuiteAdmin(admin.ModelAdmin):
    list_display = ['name', 'suite_type', 'browser_type', 'created_by', 'created_at']
    list_filter = ['suite_type', 'browser_type', 'created_at']
    search_fields = ['name', 'description']

@admin.register(TestCase)
class TestCaseAdmin(admin.ModelAdmin):
    list_display = ['name', 'suite', 'priority', 'order', 'is_active']
    list_filter = ['suite', 'priority', 'is_active']
    search_fields = ['name', 'description']

@admin.register(TestExecution)
class TestExecutionAdmin(admin.ModelAdmin):
    list_display = ['suite', 'status', 'started_at', 'finished_at', 'executed_by']
    list_filter = ['status', 'started_at']
    search_fields = ['suite__name']
    readonly_fields = ['started_at', 'finished_at']